﻿//
// This file is part of AVSReflector project
// Copyright (C) 2011 Yuan Pengfei
//

using System;
using System.Collections.Generic;
using System.Text;

namespace AVSReflector.Core
{
    public class UserData : INode
    {
        public byte[] data;

        public string[] GetInfo()
        {
            List<string> lines = new List<string>();
            for (int i = 0; i < data.Length; ++i)
                lines.Add(String.Format("user_data[{0}] = 0x{1:X}", i, data[i]));
            return lines.ToArray();
        }

        public static UserData Parse(BitStream s)
        {
            UserData ret = new UserData();
            List<byte> l = new List<byte>();
            while (s.Peek(24) != 0x1)
                l.Add((byte)s.Read(8));
            ret.data = l.ToArray();
            return ret;
        }
    }
}
